import { ResPage, Member } from "@/api/interface/index";
import { PORT1 } from "@/api/config/servicePort";
import http from "@/api";
import qs from "qs";

/**
 * @name 会员管理模块
 */

// 获取会员列表
export const getMemberList = (params: Member.ResMemberList) => {
  return http.post<ResPage<Member.ResMemberList>>(PORT1 + `/CoreCmsUser/GetPageList`, qs.stringify(params));
};

// 编辑会员
export const editMember = (params: { id: string }) => {
  return http.post(PORT1 + `/CoreCmsUser/DoEdit`, params);
};

// 新增会员
export const addMember = (params: { id: string }) => {
  return http.post(PORT1 + `/CoreCmsUser/DoCreate`, params);
};

// 删除会员
export const deleteMember = (params: { id: string }) => {
  return http.post(PORT1 + `/CoreCmsUser/DoDelete`, params);
};

// 获取会员等级列表
export const getMemberGradeList = (params: {}) => {
  return http.post<ResPage<Member.ResMemberGradeList>>(PORT1 + `/CoreCmsUserGrade/GetPageList`, qs.stringify(params));
};

// 编辑会员等级
export const editMemberGrade = (params: { id: string }) => {
  return http.post(PORT1 + `/CoreCmsUserGrade/DoEdit`, params);
};

// 删除会员等级
export const deleteMemberGrade = (params: { id: string }) => {
  return http.post(PORT1 + `/CoreCmsUserGrade/DoDelete`, params);
};

// 新增会员等级
export const addMemberGrade = (params: { id: string }) => {
  return http.post(PORT1 + `/CoreCmsUserGrade/DoCreate`, params);
};

// 获取会员分类列表
export const getUserCategoryList = (params: {}) => {
  return http.post<ResPage<Member.ResUserCategoryList>>(PORT1 + `/CoreCmsUserCategory/GetPageList`, qs.stringify(params));
};

// 新增会员分类
export const createUserCategory = (params: {}) => {
  return http.post(PORT1 + `/CoreCmsUserCategory/DoCreate`, params);
};

// 编辑会员分类
export const editUserCategory = (params: {}) => {
  return http.post(PORT1 + `/CoreCmsUserCategory/DoEdit`, params);
};

// 删除会员分类
export const deleteUserCategory = (params: {}) => {
  return http.post(PORT1 + `/CoreCmsUserCategory/DoDelete`, params);
};

// 获取会员充值规则
export const getUserDepositRulesList = (params: {}) => {
  return http.post<ResPage<Member.ResUserDepositRulesList>>(PORT1 + `/CoreCmsUserDepositRules/GetPageList`, qs.stringify(params));
};

// 新增会员充值规则
export const createUserDepositRules = (params: {}) => {
  return http.post(PORT1 + `/CoreCmsUserDepositRules/DoCreate`, params);
};

// 删除会员充值规则
export const deleteUserDepositRules = (params: {}) => {
  return http.post(PORT1 + `/CoreCmsUserDepositRules/DoDelete`, params);
};
// 编辑会员充值规则
export const editUserDepositRules = (params: {}) => {
  return http.post(PORT1 + `/CoreCmsUserDepositRules/DoEdit`, params);
};
// 获取会员充值规则详情 传id
export const getUserDepositRulesDetails = (params: {}) => {
  return http.post(PORT1 + `/CoreCmsUserDepositRules/GetEdit`, params);
};

// 会员充值
export const editUserBalance = (params: {}) => {
  return http.post(PORT1 + `/CoreCmsUser/DoEditBalance`, params);
};

// 获取会员积分规则
export const getUserPointrule = (params: {}) => {
  return http.post(PORT1 + `/CoreCmsUserPointrule/GetInfoByContext`, params);
};

// 获取优先级
export const getPriority = (params: {}) => {
  return http.post(PORT1 + `/CoreCmsUserGrade/GetIndex`, params);
};
